From: Florian Müllner Date: Mon, 18 Apr 2022 15:23:45 +0000 (+0200) Subject: lookingGlass: Handle Esc in object inspector X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~480^2^2~26 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5a4c19a8cb2cffe37bfa57b32d3790c5f26b1a6a;p=gnome-shell.git lookingGlass: Handle Esc in object inspector Currently the main looking glass dialog handles Esc for both itself and the object inspector. However as the latter now takes its own Clutter.Grab, key events never reach the main dialog while the inspector is open. Fix this by handling the Esc key in the object inspector itself. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5356 Part-of: --- diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 30d668f3c..1f10b5a8e 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -486,6 +486,15 @@ class ObjInspector extends St.ScrollView { this._obj = null; } + vfunc_key_press_event(keyPressEvent) { + const symbol = keyPressEvent.keyval; + if (symbol === Clutter.KEY_Escape) { + this.close(); + return Clutter.EVENT_STOP; + } + return super.vfunc_key_press_event(keyPressEvent); + } + _onInsert() { let obj = this._obj; this.close(); @@ -1578,10 +1587,7 @@ class LookingGlass extends St.BoxLayout { vfunc_key_press_event(keyPressEvent) { let symbol = keyPressEvent.keyval; if (symbol == Clutter.KEY_Escape) { - if (this._objInspector.visible) - this._objInspector.close(); - else - this.close(); + this.close(); return Clutter.EVENT_STOP; } // Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view